<template>
	<view class=" p-top30 p-bot140">


		<!-- 邀请入口 -->
		<!-- <view class="Box" style="padding: 0;margin: 0;background: none;margin-top: 30rpx;">
		   <view class="plr-30" @tap="go('share')">
		   	<image src="../../static/img/my/share1.png" mode="aspectFill" class="share"></image>
		   </view>
		</view> -->

		<view class="viewbox auto d-flex j-sb a-center bot_bor28 p-top30 p-bot30 " 
		     @click="pageUrl('/pages/my/Account',true)">
			<view class="d-flex " v-if="member" >
				<image class="headIcon bor_radius" :src="member.head_image" mode="aspectFill"></image>
				<view class="d-flex f-column j-centert m-left30">
					<text class="size40 white">{{member.nick_name}}</text>
					<text class="color_7e size26 m-top20">{{member.phone}}</text>
				</view>
			</view>
			<view class="d-flex" v-else @click.stop="toUrl(`/pages/login/login`)">
				<image class="headIcon bor_radius" src="../../static/imgs/morehead.png" mode="aspectFill"></image>
				<view class="d-flex f-column j-centert m-left30">
					<text class="size40 white bold">未登录</text>
					<text class="color_7e size26 m-top20">登录后可查看你的数字藏品</text>
				</view>
			</view>
			<view class="iconfont icon-a-zujian32 color_7e size26"></view>
		</view>

		<view class="viewbox auto p-top20 p-bot20 d-flex j-sb a-center m-top20" v-if="chain_account">
			<view class="ellipsis  size26 color_7e">区块链地址：{{chain_account}}</view>
			<view class="iconfont icon-fuzhi color_ccc size36 p-left16" @click="$getClip(chain_account)"></view>
		</view>
		<view class="viewbox auto p-top20 p-bot20 d-flex j-sb a-center m-top20" v-if="!chain_account && app_token">
			<text class="color_ccc size28">实名认证后生成区块链地址</text>
			<view class="noeauthen flexac white size28 bold800" 
			     @click="pageUrl('/pages/my/authentication',true)">立即认证</view>
		</view>


		<view class="viewbox auto bg28 p-top30 p-bot30 d-flex j-sa a-center bor_radius_20  m-top30">
			<view class="d-flex f-column a-center" 
			     @click="pageUrl('/pages/order/orderList',true)">
				<view class="iconfont icon-dingdan color_ccc size54"></view>
				<text class="color_ccc size30 m-top20">我的订单</text>
			</view>
			<!-- <view class="d-flex f-column a-center"
			     @click="pageUrl('/pages/case/record',true)">
				<view class="iconfont icon-jilu color_ccc size54"></view>
				<text class="color_ccc size30 m-top20">转赠记录</text>
			</view> -->
			<!-- <view class="d-flex f-column a-center" @click="pageUrl('Withdrawal',true)">
				<view class="iconfont icon-duojizhangbuyuechaxun color_ccc size50"></view>
				<text class="color_ccc size30 m-top20">我的钱包</text>
			</view> -->
			<view class="d-flex f-column a-center" @click="pageUrl('wallet',true)">
				<view class="iconfont icon-duojizhangbuyuechaxun color_ccc size50"></view>
				<text class="color_ccc size30 m-top20">我的钱包</text>
			</view> 
			<view class="d-flex f-column a-center"
			     @click="pageUrl('/pages/case/equity',true)">
				<view class="iconfont icon-quanyi1 color_ccc size54"></view>
				<text class="color_ccc size30 m-top20">我的权益</text>
			</view>
			<view class="d-flex f-column a-center"
			     @click="pageUrl('/pages/case/airdrop',true)">
				<view class="iconfont icon-kongtou color_ccc size54"></view>
				<text class="color_ccc size30 m-top20">我的空投</text>
			</view>
			
			<!-- <view class="d-flex f-column a-center" @tap="mysales(2)">
				<view class="iconfont icon-ic_market color_ccc size54"></view>
				<text class="color_ccc size30 m-top20">我的售卖</text>
			</view>
			<view class="d-flex f-column a-center" @click="pageUrl('Withdrawal',true)">
				<view class="iconfont icon-duojizhangbuyuechaxun color_ccc size54"></view>
				<text class="color_ccc size30 m-top20">我的余额</text>
			</view> -->
			
		</view>



		<view class="viewbox auto bg28 bor_radius_20 m-top20 p-left30 p-right30">
			<view class="row j-sb a-center p-top32 p-bot32 bot_bor38"  @click="pageUrl('/share/webview/webview',true)">
				<view class="d-flex a-center">
					<view class="iconfont icon-chaxun white size36"></view>
					<text class="white size30 m-left20">链上查询</text>
				</view>
				<view class="iconfont icon-a-zujian32 color_ccc size16"></view>
			</view>
			<view class="row j-sb a-center p-top32 p-bot32 bot_bor38" @click="pageUrl('/pages/case/record',true)">
				<view class="d-flex a-center">
					<view class="iconfont icon-jilu white size44"></view>
					<text class="white size30 m-left18">转赠记录</text>
				</view>
				<view class="iconfont icon-a-zujian32 color_ccc size16"></view>
			</view>
			<view class="row j-sb a-center p-top32 p-bot32 bot_bor38"
			     @click="pageUrl('share',true)">
				<view class="d-flex a-center">
					<view class="iconfont icon-fenxiaoxitong white size42"></view>
					<text class="white size-30 m-left20">邀请好友</text>
				</view>
				<view class="iconfont icon-a-zujian32 color_ccc size16"></view>
			</view>
			<view class="row j-sb a-center p-top32 p-bot32 bot_bor38"
				  @click="pageUrl('Ranking',true)">
				<view class="d-flex a-center">
					<view class="iconfont icon-xiyongquanyi white size42"></view>
					<text class="white size-30 m-left20">排行榜单</text>
				</view>
				<view class="iconfont icon-a-zujian32 color_ccc size16"></view>
			</view>
			<view class="row j-sb a-center p-top32 p-bot32 bot_bor38"
			     @click="customer">
				<view class="d-flex a-center">
					<view class="iconfont icon-kehufuwukefu white size42"></view>
					<text class="white size-30 m-left20">联系客服</text>
				</view>
				<view class="iconfont icon-a-zujian32 color_ccc size16"></view>
			</view>
			

			<!-- <view class="row j-sb a-center p-top32 p-bot32 bot_bor38" 
				  @click="pageUrl('/pages/hecheng/hechangDetail',true)">
				<view class="d-flex a-center">
					<view class="iconfont icon-yuyinhecheng white size42"></view>
					<text class="white size-30 m-left20">合成管理</text>
				</view>
				<view class="iconfont icon-a-zujian32 color_ccc size16"></view>
			</view>
			<view class="row j-sb a-center p-top32 p-bot32 bot_bor38" 
				  @click="pageUrl('/pages/manghe/manghelist',true)">
				<view class="d-flex a-center">
					<view class="iconfont icon-daolanmanghebeifen white size42"></view>
					<text class="white size-30 m-left20">我的盲盒</text>
				</view>
				<view class="iconfont icon-a-zujian32 color_ccc size16"></view>
			</view> -->
			
		</view>


		<view class="viewbox auto bg28 bor_radius_20 m-top20 p-left30 p-right30">
			<view class="row j-sb a-center p-top32 p-bot32 "
			      @click="pageUrl('mySet',true)">
				<view class="d-flex a-center">
					<view class="iconfont icon-shezhi white size42"></view>
					<text class="white size-30 m-left20">设置中心</text>
				</view>
				<view class="iconfont icon-a-zujian32 color_ccc size16"></view>
			</view>
		</view>






	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	export default {
		data() {
			return {
				accountList: {},
				collectionList: {},
				member: '',
				countInfo: {},
				flag: true,
				showType: '1',
				backgroundColor: '',

				chain_account: '',
			}
		},
		onShow() {
			this.getMemInfo();
		},
		onLoad() {
			// this.getMemInfo();
		},
		methods: {
			...mapMutations(['getRealname']),
			
			customer(){
				if(!this.app_token) return this.toUrl('/pages/login/login');
				window.open('https://work.weixin.qq.com/kfid/kfcd1ada91ff3b6e59e')
			},
			
			//  判断是否登录
			pageUrl(url,state){
				if(state && !this.app_token) return this.toUrl('/pages/login/login');
				this.toUrl(url)
			},
			
			
			
			gotoRuzhu() {
				let url = "https://www.wenjuan.com/s/UZBZJv81GIY/";
				// #ifdef MP || APP-PLUS  
				this.go('/pages/index/ruzhu?url=' + url)
				// #endif
				// #ifdef H5
				location.href = url;
				// #endif
			},
			reload(n) {
				if (this.showType != n) {
					this.showType = n;
					this.getList();
				}
			},
			goDetail(a) {
				if (this.showType == 1) {
					uni.navigateTo({
						url: '../user/myArtDetail?goodsId=' + a
					})
				} else if (this.showType == 2) {
					uni.navigateTo({
						url: '../user/mySaleDetail?goodsId=' + a
					})
				}
			},
			getList() {
				let data = {
					status: this.showType
				}
				this.$http.post('order/collectionList', data).then(res => {
					if (res.code == 1) {
						this.collectionList = res.data;
					}
				})
			},
			getAccount() {
				this.$http.get('account/account').then(res => {
					if (res.code == 1) {
						this.accountList = res.data;
					}
				})
				this.$http.get('order/collectionCount').then(res => {
					if (res.code == 1) {
						this.countInfo = res.data;
					}
				})
			},
			getMemInfo() {
				this.$http.get('user/userInfo').then(res => {
					if (res.code == 401) return;
					if (res.code != 1) return this.$showToastTxt(res.msg);
					this.getRealname(res.data);
					if (res.data.chain_account) this.chain_account = res.data.chain_account;
					this.member = res.data;
					uni.setStorageSync('phone', res.data.phone);
					uni.setStorageSync('wx_auth', res.data.wx_small_auth);
					uni.setStorageSync('name', res.data.wx_small_auth);
					this.getList();
					this.getAccount();
				})
			},
			mysales(types) {
				if(!this.app_token) return this.toUrl('/pages/login/login')
				uni.navigateTo({
					url: "mysales?type=" + types
				})
			}
		},
		
		computed:{
			...mapState(['app_token']),
		}
	}
</script>
<style>
	page {
		background-color: #1e201f;
	}
</style>
<style lang="scss" scoped>
	.headIcon {
		width: 140rpx;
		height: 140rpx;
	}
	.noeauthen{
		width:160rpx;
		height: 50rpx;
		border-radius: 25rpx;
		background-color: #ead097;
	}
</style>
